#ifndef CIOPS_OP_CREATECUBOID_H
#define CIOPS_OP_CREATECUBOID_H

#include <strstream>

#include "Operation.h"

namespace CIOps {
    /**
     * This class represents the operation of creation of a cuboid   
     **/
    class OP_CreateCuboid : public Operation {    

    public:            
        OP_CreateCuboid (std::vector<CIView::View*>& v);        //Constructor
        virtual ~OP_CreateCuboid();                             //Destructor

    protected:
        CIGeom::Geometry* cuboid;                   //A pointer to the cuboid that will be added in the 3D scene
        CICore::Point topLeft;                      //The top left coordinate of the cuboid

        CICore::Orientation rotation;

        float height;                       //The cuboid height
        float width;                        //The cuboid width  

        short cuboidDetail;                 //The cuboid tessellation detail

        void AddFace (CICore::Vertex* v1, CICore::Vertex* v2, CICore::Vertex* v3, CICore::FaceLib& newFaces);
        
    public:            
        //Utility Methods
        virtual int Exec();         //Method called to execute directly the operation
        virtual void Undo();        //Method called to undo the operation
        virtual void Redo();        //Method called to redo the operation

        virtual void MousePressEvent (CIView::View* view, QMouseEvent* e);        //Mouse Pressed event handler
        virtual void MouseReleaseEvent (CIView::View* view, QMouseEvent* e);      //Mouse Released event handler
        virtual void MouseMoveEvent (CIView::View* view, QMouseEvent* e);         //Mouse Moved event handler
        virtual void WheelEvent (CIView::View* view, QWheelEvent* e);             //Wheel event handler
    };
}

#endif /* CIOPS_OP_CREATECUBOID_H */
